<?php
class MyCurl
{
    var $url;
    var $result;
    var $httpCode;
    function __construct($url, $session)
    {
        $this->url = $url;
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_COOKIE, $session);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_ACCEPT_ENCODING, "gzip,deflate");
        $user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36";
        curl_setopt($curl, CURLOPT_USERAGENT, $user_agent);
        // $proxy = "127.0.0.1:2333";
        // curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
        // curl_setopt($curl, CURLOPT_PROXY, $proxy);

        $this->result = curl_exec($curl);
        $this->httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);
    }

    function getHttpCode()
    {
        return $this->httpCode;
    }

    function getResult()
    {
        return $this->result;
    }
}

class MyPostCurl
{
    var $url;
    var $result;
    var $httpCode;
    function __construct($url, $session, $post, $header)
    {
        $this->url = $url;
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_COOKIE, $session);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
        $user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36";
        curl_setopt($curl, CURLOPT_USERAGENT, $user_agent);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_HEADER, $header);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_ACCEPT_ENCODING, "gzip,deflate");

        // $proxy = "127.0.0.1:2333";
        // curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
        // curl_setopt($curl, CURLOPT_PROXY, $proxy);

        $this->result = curl_exec($curl);
        $this->httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);
    }

    function getHttpCode()
    {
        return $this->httpCode;
    }

    function getResult()
    {
        return $this->result;
    }
}
